package com.gxgeek.product.dataobject;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.gxgeek.product.enums.ProductStatusEnum;
import com.gxgeek.product.util.EnumUtil;
import lombok.Data;

import javax.persistence.Entity;
import javax.persistence.Id;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * Created by gx on 2017/7/11.
 */
@Entity
@Data
public class ProductInfo implements Serializable{

    private static final long serialVersionUID = 6399186181668983148L;
    @Id//主键
    private String productId;

    /** 商品名字*/
    private String productName;
    /**单价*/
    private BigDecimal productPrice;
    /**库存*/
    private Integer productStock;
    /**描述*/
    private String productDescription;
    /**小图*/
    private String productIcon;
    /**商品状态 0正常 1 下架*/
    private Integer productStatus = ProductStatusEnum.FINISHED.getCode();
    /**类目编号*/
    private Integer categoryType;

    private Date createTime;

    private Date updateTime;

    @JsonIgnore
    public ProductStatusEnum getProductStatusEnum() {
        return EnumUtil.getByCode(productStatus, ProductStatusEnum.class);
    }


}
